<!DOCTYPE html>
<html>

<head lang="en">
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="description" content="">
    <meta name="keywords" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>南京大学职业咨询室预约平台</title>
    <!-- Set render engine for 360 browser -->
    <meta name="renderer" content="webkit">
    <!-- No Baidu Siteapp-->
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link rel="icon" type="image/x-icon" href="{{ url_for('static', filename='assets/i/ico_128X128.ico') }}">
    <!-- Add to homescreen for Chrome on Android -->
    <meta name="mobile-web-app-capable" content="yes">
    <link rel="icon" sizes="192x192" href="{{ url_for('static', filename='assets/i/app-icon72x72@2x.png') }}">
    <!-- Add to homescreen for Safari on iOS -->
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-title" content="Amaze UI"/>
    <link rel="apple-touch-icon-precomposed" href="{{ url_for('static', filename='assets/i/app-icon72x72@2x.png') }}">
    <!-- Tile icon for Win8 (144x144 + tile color) -->
    <meta name="msapplication-TileImage" content="{{ url_for('static', filename='assets/i/app-icon72x72@2x.png') }}">
    <meta name="msapplication-TileColor" content="#0e90d2">

    <link rel="stylesheet" href="{{ url_for('static', filename='assets/css/amazeui.min.css') }}">
    <link rel="stylesheet" href="{{ url_for('static', filename='assets/css/amazeui.datetimepicker.css') }}">
    <link rel="stylesheet" href="{{ url_for('static', filename='assets/css/app.css', v='1.4') }}">
    <script src="{{ url_for('static', filename='assets/js/jquery.min.js') }}"></script>
    <script src="{{ url_for('static', filename='assets/js/amazeui.min.js') }}"></script>
    <script type="text/javascript" src="{{ url_for('static', filename='assets/js/amazeui.datetimepicker.min.js') }}"></script>
    <style type="text/css">

    .main {
        text-align: center;
    }
    
    #contact,
    #password {
        height: 35px;
        width: 180px;
        border: none;
    }
    
    .item {
        color: blue;
        background-color: #E93EFF;
        height: 30px;
        width: 50px;
    }
    
    #table1,
    #table2 {
        text-align: center;
    }
    .am-dropdown{
        display:block;
        margin:10px auto;
        width:80%;
    }
    .am-form-group{
        border-top:1px solid #ddd;
        padding:5px;
        margin-bottom:10px;
    }

    </style>
</head>

<body>
<div class="admin-header">
    <!--<div class="header-back" onclick="history.back()">返回</div>-->
    <div class="header-title">咨询选项</div>
</div>
<div class="content">
    <div class="main">
        <div class="am-cf">
            <div class="show_oth_opt">
                <div class="am-form-group">
                    <button type="text" style="width:140px;" id="add_tch" value="" class="am-btn am-btn-primary am-btn-sm"><i class="am-icon-plus"></i>新注册咨询师
                    </button>
                </div>
                <div class="am-form-group">
                    <button type="text" style="margin:10px auto 0 auto;width:140px;" id="alread_exist_time" value="" class="am-btn am-btn-primary am-btn-sm">已有咨询时间项</button>&nbsp;
                    <select style="" data-am-selected id="exist_time"></select>&nbsp;
                    <button style="width:140px;" class="am-btn am-btn-danger am-btn-sm" id="del_exist_time">删除</button>
                </div>
                <div class="am-form-group">
                    <button type="text" style="margin:0 auto;width:140px;" id="alread_exist_cont" value="" class="am-btn am-btn-primary am-btn-sm">已有咨询内容项</button>&nbsp;
                    <select data-am-selected id="exist_cont"></select>&nbsp;
                    <button style="width:140px;" class="am-btn am-btn-danger am-btn-sm" id="del_exist_cont">删除</button>

                </div>
                
                <div class="am-form-group">
                    <button type="text" style="margin:0 auto;width:140px;" id="alread_exist_notes" value="" class="am-btn am-btn-primary am-btn-sm">已有注意事项</button>&nbsp;
                    <select data-am-selected id="exist_notes"></select>&nbsp;
                    <button style="width:140px;" class="am-btn am-btn-danger am-btn-sm" id="del_exist_notes">删除</button>

                </div>

                <div class="am-form-group">
                <button type="text" style="width:140px;" id="add_time_opt" value="" class="am-btn am-btn-primary am-btn-sm"><i class="am-icon-plus"></i>咨询时间项</button><input type="text" style="margin: 10px auto;width:80%;" value="" placeholder="12:50" id="datetimepicker" class="am-form-field">
                </div>

                <div class="am-form-group">
                <button type="text"  style="width:140px;"id="add_cont_opt" value="" class="am-btn am-btn-primary am-btn-sm"><i class="am-icon-plus"></i>咨询内容项</button>
                    <input id="in_cont_opt" style="margin: 10px auto;width:80%;" type="text" value="" class="am-form-field" placeholder="请输入咨询内容">
                </div>
                
                <div class="am-form-group">
                <button type="text"  style="width:140px;"id="add_notes_opt" value="" class="am-btn am-btn-primary am-btn-sm"><i class="am-icon-plus"></i>注意事项</button>
                    <input id="in_notes_seq_opt" style="margin: 10px auto;width:20%;" type="text" value="" class="am-form-field" placeholder="序号">
                    <input id="in_notes_opt" style="margin: 10px auto;width:80%;" type="text" value="" class="am-form-field" placeholder="请输入注意事项">
                    <select class="sec_notes" id="notes_type" data-am-selected="{btnWidth: '80%', btnHeight: '100%', btnSize: 'sm'}">
                        <option value="排班版面">排班版面</option>
                        <option value="紧急咨询版面">紧急咨询版面</option>
                    </select>
                </div>

                <!--<div class="am-form-group">-->
                <!--<button type="text" id="add_teachers_link" value="" class="am-btn am-btn-primary am-btn-sm"><i class="am-icon-plus"></i>咨询师链接</button><input id="in_add_link" style="margin: auto;width:35%;" type="text" value="" class="am-form-field" placeholder="请输入咨询师链接">-->
                <!--</div>-->

                <div class="am-form-group">
                <button type="text" id="id_reset_all_booking" name="reset_ab" value="" class="am-btn am-btn-danger" onclick="reset_all_booking()">重置全部排班</button>
                </div>
                <div class="am-form-group">
                <button type="text" id="id_disable_booking" name="disable" value="" class="am-btn am-btn-warning" onclick="disable_booking()">设置不可预约</button>
                <button type="text" id="id_enable_booking" name="enable" value="" class="am-btn am-btn-success" onclick="enable_booking()">取消不可预约</button>
                <p>{{disabled_interval}}</p>
                <input type="text" style="margin: 10px auto;width:80%;" value="" placeholder="输入不可预约的起始日期" id="datetimepicker_begin" class="am-form-field">
                <input type="text" style="margin: 10px auto;width:80%;" value="" placeholder="输入不可预约的终止日期" id="datetimepicker_end" class="am-form-field">
                </div>
            </div>
        </div>


        <div class="add_teacher" style="display: none;">
            <table class="am-table am-table-centered" id="table1" cellpadding="0" cellspacing="0" style="border:none;">
                <tr>
                    <thead><strong>添加咨询师信息</strong></thead>
                </tr>
                
                <tr>
                    <td>&nbsp;</td>
                    <td><label>序号</label></td>
                    <td><input class="input am-form-field" type="text" name="seq" id="id_seq" value="" style="width:100%;height: 100%;"></td>
                    <td>&nbsp;</td>

                </tr>

                <tr>
                    <td>&nbsp;</td>
                    <td><label>姓名</label></td>
                    <td><input class="input am-form-field" type="text" name="name" id="id_name" value="" style="width:100%;height: 100%;"></td>
                    <td>&nbsp;</td>

                </tr>

                <tr>
                    <td>&nbsp;</td>
                    <td><label>电话</label></td>
                    <td><input class="input am-form-field" type="text" name="contact" id="id_contact" value="" style="width:100%;height: 100%;"></td>
                    <td>&nbsp;</td>

                </tr>

                <tr>
                    <td>&nbsp;</td>
                    <td><label>星期</label></td>
                    <td>
                        <select class="sec_op1" id="date_seq" data-am-selected="{btnWidth: '100%', btnHeight: '100%', btnSize: 'sm'}">
                            <option value="1">周一</option>
                            <option value="2">周二</option>
                            <option value="3">周三</option>
                            <option value="4">周四</option>
                            <option value="5">周五</option>
                        </select>
                    </td>
                    <td>&nbsp;</td>

                </tr>

                <tr>
                    <td>&nbsp;</td>
                    <td><label>时间</label></td>
                    <td><select class="sec_op2" id="time_seq" data-am-selected="{btnWidth: '100%', btnHeight: '100%', btnSize: 'sm'}">
                    <option value="1">12:30-13:20</option>
                    <option value="2">14:00-14:50</option>
                    <option value="3">15:00-15:50</option>
                    <option value="4">16:00-16:50</option>
                </select></td>
                    <td>&nbsp;</td>

                </tr>

                <tr>
                    <td>&nbsp;</td>
                    <td><label>邮箱</label></td>
                    <td><input class="input am-form-field" type="email" name="email" id="id_em" value="" style="width:100%;height: 100%;"></td>
                    <td>&nbsp;</td>

                </tr>

                <tr>
                    <td>&nbsp;</td>
                    <td><label>密码</label></td>
                    <td><input class="input am-form-field" type="password" name="pw" autocomplete="off" id="id_pw" placeholder="设置初始密码" value="" style="width:100%;height: 100%;"></td>
                    <td>&nbsp;</td>

                </tr>

                <!--<tr>-->
                    <!--<td>&nbsp;</td>-->
                    <!--<td><label>链接</label></td>-->
                    <!--<td><input class="input am-form-field" type="text" name="href" id="id_href" value=""  style="width:100%;height: 100%;"></td>-->
                    <!--<td>&nbsp;</td>-->

                <!--</tr>-->

                <tr>
                    <td>&nbsp;</td>
                    <td><label>校区</label></td>
                    <td>
                        <select class="sec_op3" id="id_pos" data-am-selected="{btnWidth: '100%', btnHeight: '100%', btnSize: 'sm'}">
                            <option value="1" selected>仙林校区</option>
                            <option value="2">鼓楼校区</option>
                        </select>
                    </td>
                    <td>&nbsp;</td>
                </tr>
            </table>

            <div>
                <br>
                <button id="commit_tch" value="" class="am-btn am-btn-primary am-btn-sm">提交</button>
                <button id="commit_tch_ret" value="" class="am-btn am-btn-default am-btn-sm">返回</button>
            </div>
        </div>
    </div>
    
    <br>
    <br>

    <div class="am-cf">
        <button type="text" id="back_" value="返回" onclick="javascript:window.location.href='./admin_center';" class="am-btn am-btn-default">返&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;回</button>
    </div>

    <form method="post" name="njusub" action="/">

    </form>
</div>

<script type="text/javascript">
    function reset_all_booking()
    {
        conf = window.confirm("确认设置所有排班为可预约状态？只允许管理员在周五下午之后重置所有排班为可预约状态！已被预约的咨询信息将自动设置为咨询完成状态！");
        if (conf) {
            document.njusub.action="/reset_all_book_info";
            document.njusub.method="post";
            document.njusub.submit();
        }
    }
    
    function enable_booking()
    {
        conf = window.confirm("该操作将取消特定时间段不可预约的限制！确认操作？");
        if (conf) {
            document.njusub.action="/enable_all_book_info";
            document.njusub.method="post";
            document.njusub.submit();
        }
    }

    function disable_booking()
    {
        if ($("#datetimepicker_begin").val()=="")
        {
            alert("请选择不可预约的起始日期");
            return false;
        }

        if ($("#datetimepicker_end").val()=="")
        {
            alert("请选择不可预约的终止日期");
            return false;
        }
        
        conf = window.confirm("确认设置不可预约的时间段？一般在假期开始前执行此选项！");
        if (conf) {
            document.njusub.action="/disable_all_book_info?begindate="+$("#datetimepicker_begin").val()+"&enddate="+$("#datetimepicker_end").val();
            document.njusub.method="post";
            document.njusub.submit();
        }
    }
    
    var date = new Date();
    $("#datetimepicker_begin").datetimepicker({
        format: 'yyyy-mm-dd',
        minView: 'month',
        autoclose:true,
        startDate: date
    });

    $("#datetimepicker_end").datetimepicker({
        format: 'yyyy-mm-dd',
        minView: 'month',
        autoclose:true,
        startDate: date
    });

    // 添加咨询师
    $("#add_tch").click(function() {
        // 获取时间选项
        var csrftoken = $('meta[name=csrf-token]').attr('content');$.ajaxSetup({beforeSend: function(xhr, settings) {if (!/^(GET|HEAD|OPTIONS|TRACE)$/i.test(settings.type) && !this.crossDomain) {xhr.setRequestHeader("X-CSRFToken", csrftoken)} }});
        $.ajax({type: 'post',url: '/existed_time',data: {a: null},async: 0,success: function(data) {
                var jsondata = eval(data);
                document.getElementById("time_seq").options.length=0;
                $.each(jsondata, function(idx, item) {
                    document.getElementById("time_seq").options.add(new Option(item.stm,item.stm));
                });
            },error: function() {alert('服务端异常');}});

        $(".input").val("");
        $(".am-cf").css("display", "none");
        $(".add_teacher").css("display", "block");
    });


    $("#ret_from_oth_opt").click(function(){
        $(".show_oth_opt").css("display", "none");
    });

    function isArguInValid(a) {
        if (a == undefined || a == "") {
            return true;
        };
    }

     function isValidEmail(a) {
        return true;
    }

    // 提交添加咨询师信息
    $("#commit_tch").click(function() {

        var s = $("#id_seq").val(),
            a = $("#id_name").val(),
            b = $("#id_contact").val(),
            c = $("#date_seq").val(),
            d = $("#time_seq").val(),
            e = $("#id_em").val(),
            f = $("#id_pw").val();
            g = $("#id_pos").val();
            
        if (isArguInValid(s)){
            alert("请将咨询师序号填写完整！");
            return false;
        }

        if (isArguInValid(a) || isArguInValid(b) || isArguInValid(c) || isArguInValid(d) || isArguInValid(e) || isArguInValid(f) || isArguInValid(g)) {
            alert("请将信息填写完整！");
            return false;
        } else {
            if (/^0?1[3|4|5|7|8][0-9]\d{8}$/.test(b) == false) {
                alert("您填写的电话号码有误！");
                return false;
            } else if (!isValidEmail(d)) {
                alert("您填写的邮箱有误！");
                return false;
            } else {
                var csrftoken = $('meta[name=csrf-token]').attr('content');
                $.ajaxSetup({
                    beforeSend: function(xhr, settings) {
                        if (!/^(GET|HEAD|OPTIONS|TRACE)$/i.test(settings.type) && !this.crossDomain) {
                            xhr.setRequestHeader("X-CSRFToken", csrftoken)
                        }
                    }
                });

                //当前咨询师预约按钮置灰
                $.ajax({
                    // 请求发送方式
                    type: 'post',
                    // 验证文件
                    url: '/regester_teacher_data',
                    // 用户输入的帐号密码
                    data: {
                        s: $("#id_seq").val(),
                        a: $("#id_name").val(),
                        b: $("#id_contact").val(),
                        c: $("#date_seq").val(),
                        d: $("#time_seq").val(),
                        e: $("#id_em").val(),
                        f: $("#id_pw").val(),
                        g: $("#id_href").val(),
                        h: $("#id_pos").val()
                    },
                    // 异步，不写默认为True
                    async: 0,
                    //请求成功后的回调
                    success: function(data) {
                        if (data) {
                            if (data.result == "1") {
                                alert(data.msg);
                            } else {
                                alert(data.msg);

                                $(".am-cf").css("display", "block");
                                $(".add_teacher").css("display", "none");
                            };

                        } else {
                            alert('用户不存在！');
                        }
                    },
                    error: function() {
                        alert('服务端异常');
                    }

                });
            }
        }
    });

    // 返回主界面
    $("#commit_tch_ret").click(function() {
        $(".input").attr("value", "");
        $(".am-cf").css("display", "block");
        $(".add_teacher").css("display", "none");
    });

    // 设置咨询时间选项和内容选项
    $("#datetimepicker").datetimepicker({
        format: 'hh:ii'
    });
    {
        function require_data(val,addr,func){
            var csrftoken = $('meta[name=csrf-token]').attr('content');$.ajaxSetup({beforeSend: function(xhr, settings) {if (!/^(GET|HEAD|OPTIONS|TRACE)$/i.test(settings.type) && !this.crossDomain) {xhr.setRequestHeader("X-CSRFToken", csrftoken)} }});
            $.ajax({type: 'post',url: addr,data: {a: val},async: 0,success: function(data) {
                    var jsondata = eval(data);
                    $.each(jsondata, function(idx, item) {

                    });
                },error: function() {alert('服务端异常');}});
        }

        function show_exist_cont()
        {
            var csrftoken = $('meta[name=csrf-token]').attr('content');$.ajaxSetup({beforeSend: function(xhr, settings) {if (!/^(GET|HEAD|OPTIONS|TRACE)$/i.test(settings.type) && !this.crossDomain) {xhr.setRequestHeader("X-CSRFToken", csrftoken)} }});
            $.ajax({type: 'post',url: '/existed_cont',data: {a: null},async: 0,success: function(data) {
                var jsondata = eval(data);
                document.getElementById("exist_cont").options.length=0;
                $.each(jsondata, function(idx, item) {
                    document.getElementById("exist_cont").options.add(new Option(item.cont,item.cont));
                });
            },error: function() {alert('服务端异常');}});
        }

        $("#alread_exist_cont").click(function(){
            show_exist_cont();
        });

        function show_exist_time()
        {
            var csrftoken = $('meta[name=csrf-token]').attr('content');$.ajaxSetup({beforeSend: function(xhr, settings) {if (!/^(GET|HEAD|OPTIONS|TRACE)$/i.test(settings.type) && !this.crossDomain) {xhr.setRequestHeader("X-CSRFToken", csrftoken)} }});
            $.ajax({type: 'post',url: '/existed_time',data: {a: null},async: 0,success: function(data) {
                    var jsondata = eval(data);
                    document.getElementById("exist_time").options.length=0;
                    $.each(jsondata, function(idx, item) {
                        document.getElementById("exist_time").options.add(new Option(item.stm,item.stm));
                    });
                },error: function() {alert('服务端异常');}});
        }
        $("#alread_exist_time").click(function(){
            show_exist_time();
        });
        
        function show_exist_notes()
        {
            var csrftoken = $('meta[name=csrf-token]').attr('content');$.ajaxSetup({beforeSend: function(xhr, settings) {if (!/^(GET|HEAD|OPTIONS|TRACE)$/i.test(settings.type) && !this.crossDomain) {xhr.setRequestHeader("X-CSRFToken", csrftoken)} }});
            $.ajax({type: 'post',url: '/existed_notes',data: {a: null},async: 0,success: function(data) {
                    var jsondata = eval(data);
                    document.getElementById("exist_notes").options.length=0;
                    $.each(jsondata, function(idx, item) {
                        document.getElementById("exist_notes").options.add(new Option(item.type+'- '+item.seq+'.'+item.content,item.id));
                    });
                },error: function() {alert('服务端异常');}});
        }
        $("#alread_exist_notes").click(function(){
            show_exist_notes();
        });

        $("#del_exist_cont").click(function(){
            if ($("#exist_cont").val()==null || $("#exist_cont").val()=="") {
                alert("请先选择要删除的内容项");
                return false;
            };
            conf = window.confirm("确认删除 "+$("#exist_cont").val()+" 内容？");
            if (conf) {
                var csrftoken = $('meta[name=csrf-token]').attr('content');$.ajaxSetup({beforeSend: function(xhr, settings) {if (!/^(GET|HEAD|OPTIONS|TRACE)$/i.test(settings.type) && !this.crossDomain) {xhr.setRequestHeader("X-CSRFToken", csrftoken)} }});
                $.ajax({type: 'post',url: '/del_cont_opt',data: {cont: $("#exist_cont").val()},async: 0,success: function(data) {
                        alert("删除咨询内容成功！");
                        show_exist_cont();
                    },error: function() {alert('服务端异常');}});
            };
        });

        $("#del_exist_time").click(function(){
            if ($("#exist_time").val()==null || $("#exist_time").val()=="") {
                alert("请先选择要删除的时间项");
                return false;
            };
            conf = window.confirm("确认删除 "+$("#exist_time").val()+" 时间？");
            if (conf) {
                var csrftoken = $('meta[name=csrf-token]').attr('content');$.ajaxSetup({beforeSend: function(xhr, settings) {if (!/^(GET|HEAD|OPTIONS|TRACE)$/i.test(settings.type) && !this.crossDomain) {xhr.setRequestHeader("X-CSRFToken", csrftoken)} }});
                $.ajax({type: 'post',url: '/del_time_opt',data: {stm: $("#exist_time").val()},async: 0,success: function(data) {
                        alert("删除咨询时间选项成功！");
                        show_exist_time();
                    },error: function() {alert('服务端异常');}});
            }
        });
        
        $("#del_exist_notes").click(function(){
            if ($("#exist_notes").val()==null || $("#exist_notes").val()=="") {
                alert("请先选择要删除的注意事项");
                return false;
            };
            conf = window.confirm("确认删除已选注意事项？");
            if (conf) {
                var csrftoken = $('meta[name=csrf-token]').attr('content');$.ajaxSetup({beforeSend: function(xhr, settings) {if (!/^(GET|HEAD|OPTIONS|TRACE)$/i.test(settings.type) && !this.crossDomain) {xhr.setRequestHeader("X-CSRFToken", csrftoken)} }});
                $.ajax({type: 'post',url: '/del_notes_opt',data: {noteid: $("#exist_notes").val()},async: 0,success: function(data) {
                        alert("删除咨询注意事项成功！");
                        show_exist_notes();
                    },error: function() {alert('服务端异常');}});
            }
        });

        $("#add_time_opt").click(function(){
            if ($("#datetimepicker").val()==null || $("#datetimepicker").val()=="") {
                alert("请选择要添加的咨询时间");
                return false;
            };
            var csrftoken = $('meta[name=csrf-token]').attr('content');$.ajaxSetup({beforeSend: function(xhr, settings) {if (!/^(GET|HEAD|OPTIONS|TRACE)$/i.test(settings.type) && !this.crossDomain) {xhr.setRequestHeader("X-CSRFToken", csrftoken)} }});
            $.ajax({type: 'post',url: '/add_time_opt',data: {stm: $("#datetimepicker").val()},async: 0,success: function(data) {
                    if (data.ret) {
                        alert("成功添加咨询时间选项！");
                    };
                    $("#datetimepicker").val("");
                },error: function() {alert('服务端异常');}});
        });

        $("#add_cont_opt").click(function(){
            if ($("#in_cont_opt").val()==null || $("#in_cont_opt").val()=="") {
                alert("请输入要添加的咨询内容");
                return false;
            };
            var csrftoken = $('meta[name=csrf-token]').attr('content');$.ajaxSetup({beforeSend: function(xhr, settings) {if (!/^(GET|HEAD|OPTIONS|TRACE)$/i.test(settings.type) && !this.crossDomain) {xhr.setRequestHeader("X-CSRFToken", csrftoken)} }});
            $.ajax({type: 'post',url: '/add_cont_opt',data: {cont: $("#in_cont_opt").val()},async: 0,success: function(data) {
                    if (data.ret) {
                        alert("成功添加咨询内容选项！");
                    };
                    $("#in_cont_opt").val("");
                },error: function() {alert('服务端异常');}});
        });
        
        $("#add_notes_opt").click(function(){
            if ($("#in_notes_seq_opt").val()==null || $("#in_notes_seq_opt").val()=="") {
                alert("请输入要添加咨询注意事项的序号");
                return false;
            };
            if ($("#in_notes_opt").val()==null || $("#in_notes_opt").val()=="") {
                alert("请输入要添加的咨询注意事项");
                return false;
            };

            if ($("#notes_type").val()==null || $("#notes_type").val()==""){
                alert("请选择要添加的咨询注意事项所属的版面");
                return false;
            }

            var csrftoken = $('meta[name=csrf-token]').attr('content');$.ajaxSetup({beforeSend: function(xhr, settings) {if (!/^(GET|HEAD|OPTIONS|TRACE)$/i.test(settings.type) && !this.crossDomain) {xhr.setRequestHeader("X-CSRFToken", csrftoken)} }});
            $.ajax({type: 'post',url: '/add_notes_opt',data: {notes_seq:$("#in_notes_seq_opt").val(), notes: $("#in_notes_opt").val(),type: $("#notes_type").val()},async: 0,success: function(data) {
                    if (data.ret) {
                        alert("成功添加咨询注意事项！");
                    };
                    $("#in_notes_opt").val("");
                    $("#in_notes_seq_opt").val("");
                    $("#note_type").val("");
                },error: function() {alert('服务端异常');}});
        });

        $("#add_teachers_link").click(function(){
            if ($("#in_add_link").val()==null || $("#in_add_link").val()=="") {
                alert("请输入要添加的咨询师链接");
                return false;
            };
            var csrftoken = $('meta[name=csrf-token]').attr('content');$.ajaxSetup({beforeSend: function(xhr, settings) {if (!/^(GET|HEAD|OPTIONS|TRACE)$/i.test(settings.type) && !this.crossDomain) {xhr.setRequestHeader("X-CSRFToken", csrftoken)} }});
            $.ajax({type: 'post',url: '/add_teachers_link',data: {link: $("#in_add_link").val()},async: 0,success: function(data) {
                    if (data.ret) {
                        alert("成功添加咨询师链接！");
                    };
                    $("#in_add_link").val("");
                },error: function() {alert('服务端异常');}});
        });
    }

</script>
</body>

</html>
